<template>
    <view class="user">
        <view class="user-header">
            <view class="avatar">
                <u-image v-if="userInfo.avatar" :src="userInfo.avatar" height="64" width="64">
                    <u-icon name="account" :size="46"></u-icon>
                </u-image>
                <u-icon v-else name="account" :size="46"></u-icon>
            </view>
            <view class="text">
                <view class="text-h">{{ userInfo.userName }}</view>
                <view class="text-t">
                    <text>部门：{{ userInfo.dept.deptName }}</text>
                    <text>电话：{{ userInfo.phonenumber }}</text>
                    <!-- <text>邮箱：{{ userInfo.email }}</text> -->
                </view>
            </view>
        </view>
        <view>

            <!-- <w-user-info :content="item.content" :styles="item.styles" :user="userInfo" :is-login="isLogin" /> -->

            <w-my-service :content="list" />
        </view>
        <tabbar />
    </view>
</template>

<script setup lang="ts">
import { useUserStore } from '@/stores/user'
import { onShow } from '@dcloudio/uni-app'
import { storeToRefs } from 'pinia'
import { ref } from 'vue'
const list = ref({
    "style": 2,
    "title": "服务中心",
    "data": [
        {
            "image": "https://cdn.sunsagri.com/group1/default/20220118/10/12/0/icon_xssq.png",
            "name": "我的收藏",
            "link": {
                "path": "/pages/collection/collection",
                "name": "我的收藏",
                "type": "shop"
            }
        },
        {
            "image": "https://cdn.sunsagri.com/group1/default/20230727/11/54/0/分组 7（9）.png",
            "name": "个人设置",
            "link": {
                "path": "/pages/user_set/user_set",
                "name": "个人设置",
                "type": "shop"
            }
        },
        {
            "image": "https://cdn.sunsagri.com/group1/default/20220118/10/12/0/icon_zjjsc.png",
            "name": "联系客服",
            "link": {
                "path": "/pages/customer_service/customer_service",
                "name": "联系客服",
                "type": "shop"
            }
        }
    ]
})
const userStore = useUserStore()
const { userInfo, isLogin } = storeToRefs(userStore)
onShow(() => {
    userStore.getUser()
})
</script>

<style lang="scss" scoped>
.user-header {
    display: flex;
    align-items: center;
    padding: 30px 10px;
    background: #fff;

    .avatar {
        width: 64px;
        height: 64px;
        text-align: center;
        line-height: 64px;
        background: #f2f2f2;
        color: #aaa;
        border-radius: 8px;
    }

    .text {
        padding-left: 20px;

        .text-h {
            font-size: 22px;
            padding-bottom: 10px;
        }

        .text-t {
            font-size: 12px;
            color: #888;

            text {
                padding: 0 10px 10px 0;
            }
        }
    }
}
</style>
